<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     */
    public function up()
    : void
    {
        Schema::create('user_ref_qnr',function(Blueprint $table) {

            // 数据类型
            $table->engine = 'InnoDB';

            $table->comment('用户关联问卷表');

            // 主键id
            $table->bigIncrements('id');
            $table->uuid('ref_id')->nullable(false)->unique();
            $table->uuid('qnr_id')->nullable(false)->comment('相关ID');
            $table->uuid('user_id')->nullable(false);
            $table->string('content',255)->nullable()->comment('内容');
            $table->timestamps();

            $table->index('qnr_id');
            $table->index('user_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    : void
    {
        Schema::dropIfExists('user_ref_qnr');
    }
};
